#!/bin/bash
export ANDROID_NDK_ROOT=/mnt/android_home/ndk/android-ndk-r28c
# 例如：
# 清理旧构建
rm -rf $BUILD_DIR $INSTALL_DIR

SYSTEMROOT=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/sysroot
TOOLCHAIN_PREFIX=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64
API=21
#cd /opt/module/ffmpeg/src/release/4.4 ll -l /mnt/android_home/ndk/android-ndk-r28ctoolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/21/pkgconfig
cd /opt/module/src/ffmpeg/n8.1-dev
CPU=armv8-a
PREFIX=$PWDPATH/android/lib/$CPU
ARCH=arm64
CFLAGS="-march=armv8-a"
ARCH_TYPE=aarch64-linux-android
CXX=$TOOLCHAIN_PREFIX/bin/$ARCH_TYPE$API-clang++
CC=$TOOLCHAIN_PREFIX/bin/$ARCH_TYPE$API-clang
./configure \
--prefix=$PREFIX \
--arch=$ARCH \
--target-os=linux \
--enable-cross-compile \
--cross-prefix=$TOOLCHAIN_PREFIX/bin/llvm- \
--sysroot=$SYSTEMROOT \
--cxx=$CXX \
--cc=$CC \
--nm=$TOOLCHAIN_PREFIX/bin/llvm-nm \
--extra-cxxflags="-D__thumb__ -fexceptions -frtti" \
--extra-cflags="$CFLAGS -Os -fPIC -DANDROID -Wfatal-errors -Wno-deprecated" \
--extra-ldflags="-L$SYSTEMROOT/usr/lib" \
--disable-shared \
--enable-static \
--enable-gpl \
--enable-version3 \
--enable-runtime-cpudetect \
--enable-small \
--enable-network \
--disable-iconv \
--enable-asm \
--enable-neon \
--enable-yasm \
--disable-encoders \
--enable-encoder=h263 \
--enable-encoder=libx264 \
--enable-encoder=aac \
--enable-encoder=mpeg4 \
--enable-encoder=mjpeg \
--enable-encoder=png \
--enable-encoder=gif \
--enable-encoder=bmp \
--disable-muxers \
--enable-muxer=h264 \
--enable-muxer=flv \
--enable-muxer=gif \
--enable-muxer=mp3 \
--enable-muxer=dts \
--enable-muxer=mp4 \
--enable-muxer=mov \
--enable-muxer=mpegts \
--disable-decoders \
--enable-decoder=aac \
--enable-decoder=aac_latm \
--enable-decoder=mp3 \
--enable-decoder=h263 \
--enable-decoder=h264 \
--enable-decoder=mpeg4 \
--enable-decoder=mjpeg \
--enable-decoder=gif \
--enable-decoder=png \
--enable-decoder=bmp \
--enable-decoder=yuv4 \
--disable-demuxers \
--enable-demuxer=image2 \
--enable-demuxer=h263 \
--enable-demuxer=h264 \
--enable-demuxer=flv \
--enable-demuxer=gif \
--enable-demuxer=aac \
--enable-demuxer=ogg \
--enable-demuxer=dts \
--enable-demuxer=mp3 \
--enable-demuxer=mov \
--enable-demuxer=m4v \
--enable-demuxer=concat \
--enable-demuxer=mpegts \
--enable-demuxer=mjpeg \
--enable-demuxer=mpegvideo \
--enable-demuxer=rawvideo \
--enable-demuxer=yuv4mpegpipe \
--enable-demuxer=rtsp \
--disable-parsers \
--enable-parser=aac \
--enable-parser=ac3 \
--enable-parser=h264 \
--enable-parser=mjpeg \
--enable-parser=png \
--enable-parser=bmp\
--enable-parser=mpegvideo \
--enable-parser=mpegaudio \
--disable-protocols \
--enable-protocol=file \
--enable-protocol=hls \
--enable-protocol=concat \
--enable-protocol=rtp \
--enable-protocol=rtmp \
--enable-protocol=rtmpt \
--disable-filters \
--disable-filters \
--enable-filter=aresample \
--enable-filter=asetpts \
--enable-filter=setpts \
--enable-filter=ass \
--enable-filter=scale \
--enable-filter=concat \
--enable-filter=atempo \
--enable-filter=movie \
--enable-filter=overlay \
--enable-filter=rotate \
--enable-filter=transpose \
--enable-filter=hflip \
--disable-outdevs \
--disable-doc \
--disable-ffplay \
--disable-ffmpeg \
--disable-debug \
--disable-ffprobe \
--disable-postproc \
--enable-avdevice \
--disable-symver \
--enable-zlib \
--disable-stripping

